package com.zj.dao;

import com.zj.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface UserDao {
    List<User> selectAll();

    @Select("select * from user where userid = #{id}")
    User selectByDId(int id);

    @Update("update user set balance = balance + #{balance} where userid = #{id}")
    int balanceInById(@Param("id") int id, @Param("balance")float balance);


    @Update("update user set balance = balance - #{balance} where userid = #{id}")
    int balanceOutById(@Param("id") int id, @Param("balance")float balance);
}
